

// 构造common 对象
var common = new Object();
common.isMobile = function () {
    let flag = navigator.userAgent.match(
        /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
    );
    return flag;
};
// 判断是否是移动端

// 初始化 头部
function tabInit() {
    let screenHeight = window.screen.height;
    // 按钮点击事件
    $('.mb-btn').on('click', () => {
        if ($(".mb-full").hasClass('add-img')) {
            $(".mb-full").attr("src", "../img/mb-menu.png").css({ "transtion": "all ease .5s" }).removeClass("add-img")
            $('.mb-header-menu').hide()
            $('.mb-log-center').hide()
            $("#header").css("background", "rgba(255, 255, 255, .84)")
            $('.header-logo>img').attr('src', '../img/logo.png')
        } else {
            $(".mb-full").attr("src", "../img/close.png").css({ "transtion": "all ease .5s" }).addClass("add-img")
            $('.mb-header-menu').show().find('a').css("font-size", "18px")
            $("#header").css("background", "#2d3b58")
            $('.mb-log-center').show()
            $('.header-logo>img').attr('src', '../img/white-logo.png')
        }
    })
    $('.header-logo').click(function () {
        location.href = 'index.html'
    })
    $(".log-center>span:first-child,.mb-log-center>span:first-child").click(function () {
        location.href = "login.html"
    })
    $(".log-center>span:last-child,.mb-log-center>span:last-child").click(function () {
        location.href = "reg.html"
    })
    $(window).scroll(function () {
        const top = window.pageYOffset ||
            document.documentElement.scrollTop ||
            document.body.scrollTop;
        let header = $('#header')
        if (top > header.height()) {
            if ($(".mb-log-center").css('display') == 'none') {
                header.addClass('fixed')
            } else {
                header.removeClass('fixed')
            }
        } else {
            header.removeClass('fixed')
        }
    })


}





tabInit()
